package com.rankeiot.core.translator;


import com.rankeiot.core.dict.ITitleFixedDict;

import java.util.HashMap;
import java.util.Map;

public class DictTranslator extends SimpleTranslator implements Translator{


    public DictTranslator(ITitleFixedDict[] dicts) {
        super(dictToMap(dicts));

    }

    public DictTranslator(ITitleFixedDict[] dicts, boolean backTranslations) {
        super(dictToMap(dicts), backTranslations);
    }
    public static Map<Object, Object> dictToMap(ITitleFixedDict[] dicts){
        Map<Object,Object> dictMap=new HashMap<>();
        for(ITitleFixedDict dict:dicts){
            dictMap.put(dict.getValue(),dict.getTitle());
        }
        return dictMap;
    }
}
